home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
comm
/
term
/
vltj5867.lha
/
VLT
/
rexx
/
2.04ScreenMode.vlt
next >
Wrap
Text File
|
1994-03-29
|
7KB
|
271 lines
/** VLTPhoneBook.vlt
*
* This program brings up the main VLT PhoneBook requester.
*
* By W.G.J. Langeveld, February 1992.
*
* This program really wants to be called *from inside* VLT, so assign
* ~@VLTPhoneBook.vlt to your favorite function key, or select it from
* VLT's menu.
*
* Add the libraries if they're not there yet.
*
**/
if show("l", "rexxarplib.library") = 0 then do
check = addlib('rexxsupport.library', 0, -30, 0)
check = addlib('rexxarplib.library', 0, -30, 0)
end
/*
* The following sequence determines both VLT's screen and port name,
* and also gets the number screen rows and columns.
*/
vltport = address()
cols = ScreenCols(vltport)
if cols == -1 then do
vltscreen = ""
cols = ScreenCols()
rows = ScreenRows()
end
else do
vltscreen = vltport
rows = ScreenRows(vltscreen)
end
if ~OpenPort(VLTSCREENPORT) then exit 0
/*
* Set up a host. This time, send all messages to VLT.
*/
address AREXX "'x = CreateHost(VLTSCREENMODE, VLTSCREENPORT, "vltscreen")'"
/*
* Wait until it is ready.
*/
do i = 1
if showlist('p', VLTSCREENMODE) ~= 0 then leave
call delay 30
end
call SetReqColor(VLTSCREENMODE, BACKGROUNDPEN, 0)
/*
* Open the window
*/
idcmp = 'CLOSEWINDOW+GADGETUP+MENUPICK'
flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+ACTIVATE'
call OpenWindow(VLTSCREENMODE, cols - 260, rows - 195, 240, 190, idcmp, ,
flags, "2.04 ScreenMode")
"extract screenparams"
parse var VLT.screenparams mode width height size auto depth
/*
102400 (ntsc) or 32768 (default) highres
102404 (ntsc) or 32772 (default) highres laced
167936 pal
167940 pal laced
*/
if (mode = 102400) | (mode = 32768) then do
mode = 0
lace = 0
end
else if (mode = 102404) | (mode = 32772) then do
mode = 0
lace = 1
end
else if mode = 167936 then do
mode = 1
lace = 0
end
else if mode = 167940 then do
mode = 1
lace = 1
end
else do
"message (You seem to have a non-standard*nmode id:" mode "*nYou may not want to continue.)"
mode = 0
lace = 1
end
/*
* Add the gadgets
*/
call AddGadget(VLTSCREENMODE, 10, 30, 1, " NTSC ", "NTSC")
call AddGadget(VLTSCREENMODE, 130, 30, 2, " PAL ", "PAL")
call AddGadget(VLTSCREENMODE, 10, 50, 3, " Interlace ", "LACE")
call AddGadget(VLTSCREENMODE, 130, 50, 4, " Autoscroll ", "AUTO")
call AddGadget(VLTSCREENMODE, 10, 70,10, " Text ", "TEXT")
call AddGadget(VLTSCREENMODE, 66, 70,11, "Graph.", "GRAP")
call AddGadget(VLTSCREENMODE, 122, 70,12, " Max. ", "MAX")
call AddGadget(VLTSCREENMODE, 178, 70,13, " Extr.", "EXTR")
call AddGadget(VLTSCREENMODE, 70, 90, 5, width , "%d%1%g", 150, RIDGEBORDER)
call AddGadget(VLTSCREENMODE, 70, 110, 6, height , "%d%1%g", 150, RIDGEBORDER)
call AddGadget(VLTSCREENMODE, 70, 130, 7, depth , "%d%1%g", 150, RIDGEBORDER)
call AddGadget(VLTSCREENMODE, 10, 150, 8, "\ Okay \" , "OKAY")
call AddGadget(VLTSCREENMODE, 130, 150, 9, "\ Cancel \" , "CANCEL")
call SetAPen(VLTSCREENMODE, 1)
call SetFont(VLTSCREENMODE, "topaz.font", 8)
call Move(VLTSCREENMODE, 10, 98)
call Text(VLTSCREENMODE, "Width")
call Move(VLTSCREENMODE, 10, 118)
call Text(VLTSCREENMODE, "Height")
call Move(VLTSCREENMODE, 10, 138)
call Text(VLTSCREENMODE, "Depth")
if mode = 0 then call SetGadget(VLTSCREENMODE, 1, ON)
if mode = 1 then call SetGadget(VLTSCREENMODE, 2, ON)
if lace = 1 then call SetGadget(VLTSCREENMODE, 3, ON)
if auto = 1 then call SetGadget(VLTSCREENMODE, 4, ON)
call SetGadget(VLTSCREENMODE, 9 + size, ON)
quitflag = 0
finalpass = 0
do forever
if quitflag = 1 then leave
t = waitpkt(VLTSCREENPORT)
do forever
p = getpkt(VLTSCREENPORT)
if c2d(p) = 0 then leave
cmd = getarg(p)
if datatype(cmd, 'W') ~= 0 then string = getarg(p, 1)
t = reply(p, 0)
/*
* See what we got
*/
if finalpass = 0 then do
if cmd = CLOSEWINDOW then do
call CloseWindow(hostname)
quitflag = 1
end
else if cmd = "NTSC" then do
if mode ~= 0 then do
call SetGadget(VLTSCREENMODE, 1, ON)
call SetGadget(VLTSCREENMODE, 2, OFF)
mode = 0
end
end
else if cmd = "PAL" then do
if mode = 0 then do
call SetGadget(VLTSCREENMODE, 1, OFF)
call SetGadget(VLTSCREENMODE, 2, ON)
mode = 1
end
end
else if cmd = "LACE" then do
if lace = 0 then do
call SetGadget(VLTSCREENMODE, 3, ON)
lace = 1
end
else do
call SetGadget(VLTSCREENMODE, 3, OFF)
lace = 0
end
end
else if cmd = "AUTO" then do
if auto = 0 then do
call SetGadget(VLTSCREENMODE, 4, ON)
auto = 1
end
else do
call SetGadget(VLTSCREENMODE, 4, OFF)
auto = 0
end
end
else if cmd = "TEXT" then do
if size ~= 1 then do
call SetGadget(VLTSCREENMODE, 9 + size, OFF)
call SetGadget(VLTSCREENMODE, 10, ON)
size = 1
end
end
else if cmd = "GRAP" then do
if size ~= 2 then do
call SetGadget(VLTSCREENMODE, 9 + size, OFF)
call SetGadget(VLTSCREENMODE, 11, ON)
size = 2
end
end
else if cmd = "MAX" then do
if size ~= 3 then do
call SetGadget(VLTSCREENMODE, 9 + size, OFF)
call SetGadget(VLTSCREENMODE, 12, ON)
size = 3
end
end
else if cmd = "EXTR" then do
if size ~= 4 then do
call SetGadget(VLTSCREENMODE, 9 + size, OFF)
call SetGadget(VLTSCREENMODE, 13, ON)
size = 4
end
end
else if cmd = "OKAY" then do
/*
* Send read requests for all gadgets and set up for second pass
*/
call ReadGadget(VLTSCREENMODE, 5)
call ReadGadget(VLTSCREENMODE, 6)
call ReadGadget(VLTSCREENMODE, 7)
finalpass = 1
end
else if cmd = CANCEL then do
call CloseWindow(VLTSCREENMODE)
quitflag = 1
end
end
else do
/*
* Second pass. We're reading the gadgets
*/
if datatype(cmd, 'W') ~= 0 then do
if cmd = 5 then width = string
if cmd = 6 then height = string
if cmd = 7 then do
depth = string
call CloseWindow(VLTSCREENMODE)
quitflag = 1
end
end
end
end
end
/*
* Write out the modified data
*/
if finalpass = 1 then do
if mode = 0 then do
if lace = 0 then do
mode = 102400
end
else do
mode = 102404
end
end
else do
if lace = 0 then do
mode = 167936
end
else do
mode = 167940
end
end
if depth > 3 then depth = 3
if depth < 1 then depth = 1
if auto ~= 0 then auto = 1
if width < 320 then width = 320
if height < 200 then height = 200
if size > 4 then size = 4
if size < 1 then size = 1
"customscreen mode" mode "autoscroll" auto "width" width "height" height "depth" depth "overscan" size
end
exit